/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007-2008 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.projects.toolbox_basics_project.spring.manager;

import java.util.Collection;

import com.genia.toolbox.persistence.exception.PersistenceException;
import com.genia.toolbox.projects.toolbox_basics_project.bean.PersistableApplicationParameter;
import com.genia.toolbox.projects.toolbox_basics_project.bean.model.Parameter;

/**
 * manager to handle
 * {@link com.genia.toolbox.projects.toolbox_basics_project.bean.model.Parameter}.
 */
public interface ParameterManager
{

  /**
   * returns a {@link Parameter} knowing its reference name.
   * 
   * @param referenceName
   *          the reference name of the parameter
   * @return the {@link Parameter} having the given reference name, or
   *         <code>null</code> if no such object exists
   * @throws PersistenceException
   *           when an error occured
   */
  public abstract Parameter getParameter(String referenceName)
      throws PersistenceException;



  /**
   * delete a {@link Parameter}.
   * 
   * @param parameter
   *          the {@link Parameter} to delete
   * @throws PersistenceException
   *           when an error occured
   */
  public abstract void delete(Parameter parameter)
      throws PersistenceException;



  /**
   * getter for the applicationParameters property.
   * 
   * @return the applicationParameters
   */
  public abstract Collection<PersistableApplicationParameter<?>> getApplicationParameters();



  /**
   * returns an {@link PersistableApplicationParameter} by its referenceName.
   * 
   * @param referenceName
   *          the reference name of the parameter
   * @return an {@link PersistableApplicationParameter} by its referenceName
   */
  public abstract PersistableApplicationParameter<?> getApplicationParameter(String referenceName);



  /**
   * save a not yet persistent object.
   * 
   * @param parameter
   *          the object to save
   * @throws PersistenceException
   *           if an error occured
   */
  public abstract void save(Parameter parameter)
      throws PersistenceException;



  /**
   * update a persistent object.
   * 
   * @param parameter
   *          the object to update
   * @throws PersistenceException
   *           if an error occured
   */
  public abstract void update(Parameter parameter)
      throws PersistenceException;
}
